<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //async await必须连用
    function fn1() {
        return "fn1";
    }
    function fn2() {
      
        return new Promise((resolve,reject) => {
           setTimeout(() => {
           num = 10;
           resolve();
           }, 1000); 
        })
    }
    function fn3() {
        console.log(num);
        return "fn3";
    }
    async function fn4() {
        console.log(fn1());
        console.log(await fn2());
        console.log(fn3());
    }
    fn4();
</script>
</html>